/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ch.uzh.ifi.seal.ssqa.model.impl;

import ch.uzh.ifi.seal.ssqa.model.Coupling;
import ch.uzh.ifi.seal.ssqa.model.ModelPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Coupling</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.CouplingImpl#getFirstSource <em>First Source</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.CouplingImpl#getSecondSource <em>Second Source</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.CouplingImpl#getValue <em>Value</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class CouplingImpl extends EObjectImpl implements Coupling {
	/**
	 * The default value of the '{@link #getFirstSource() <em>First Source</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFirstSource()
	 * @generated
	 * @ordered
	 */
	protected static final String FIRST_SOURCE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getFirstSource() <em>First Source</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFirstSource()
	 * @generated
	 * @ordered
	 */
	protected String firstSource = FIRST_SOURCE_EDEFAULT;

	/**
	 * The default value of the '{@link #getSecondSource() <em>Second Source</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSecondSource()
	 * @generated
	 * @ordered
	 */
	protected static final String SECOND_SOURCE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getSecondSource() <em>Second Source</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSecondSource()
	 * @generated
	 * @ordered
	 */
	protected String secondSource = SECOND_SOURCE_EDEFAULT;

	/**
	 * The default value of the '{@link #getValue() <em>Value</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getValue()
	 * @generated
	 * @ordered
	 */
	protected static final Integer VALUE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getValue() <em>Value</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getValue()
	 * @generated
	 * @ordered
	 */
	protected Integer value = VALUE_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected CouplingImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ModelPackage.Literals.COUPLING;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getFirstSource() {
		return firstSource;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setFirstSource(String newFirstSource) {
		String oldFirstSource = firstSource;
		firstSource = newFirstSource;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.COUPLING__FIRST_SOURCE, oldFirstSource, firstSource));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getSecondSource() {
		return secondSource;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSecondSource(String newSecondSource) {
		String oldSecondSource = secondSource;
		secondSource = newSecondSource;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.COUPLING__SECOND_SOURCE, oldSecondSource, secondSource));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Integer getValue() {
		return value;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setValue(Integer newValue) {
		Integer oldValue = value;
		value = newValue;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.COUPLING__VALUE, oldValue, value));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ModelPackage.COUPLING__FIRST_SOURCE:
				return getFirstSource();
			case ModelPackage.COUPLING__SECOND_SOURCE:
				return getSecondSource();
			case ModelPackage.COUPLING__VALUE:
				return getValue();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ModelPackage.COUPLING__FIRST_SOURCE:
				setFirstSource((String)newValue);
				return;
			case ModelPackage.COUPLING__SECOND_SOURCE:
				setSecondSource((String)newValue);
				return;
			case ModelPackage.COUPLING__VALUE:
				setValue((Integer)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ModelPackage.COUPLING__FIRST_SOURCE:
				setFirstSource(FIRST_SOURCE_EDEFAULT);
				return;
			case ModelPackage.COUPLING__SECOND_SOURCE:
				setSecondSource(SECOND_SOURCE_EDEFAULT);
				return;
			case ModelPackage.COUPLING__VALUE:
				setValue(VALUE_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ModelPackage.COUPLING__FIRST_SOURCE:
				return FIRST_SOURCE_EDEFAULT == null ? firstSource != null : !FIRST_SOURCE_EDEFAULT.equals(firstSource);
			case ModelPackage.COUPLING__SECOND_SOURCE:
				return SECOND_SOURCE_EDEFAULT == null ? secondSource != null : !SECOND_SOURCE_EDEFAULT.equals(secondSource);
			case ModelPackage.COUPLING__VALUE:
				return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (firstSource: ");
		result.append(firstSource);
		result.append(", secondSource: ");
		result.append(secondSource);
		result.append(", value: ");
		result.append(value);
		result.append(')');
		return result.toString();
	}

} //CouplingImpl
